05. Check For Understanding: Functions

Check for Understanding

Let's do a quick review of concepts learned so far. As before, you will see some earlier concepts being revisited. It's important to review older concepts along with newer ones, to keep a firm grasp on your foundations.

QUIZ QUESTION::

Below are some types of statements you have used. Can you match each piece of code with the type of statement?

ANSWER CHOICES:



CODE

TYPE OF STATEMENT

size = 8

42

for i in [1, 2, 3, 4, 5]:  
  print(i)

string2.lower()

while n > 2:  
  print(i)
SOLUTION:

CODE

TYPE OF STATEMENT

size = 8

while n > 2:  
  print(i)
for i in [1, 2, 3, 4, 5]:  
  print(i)

42

string2.lower()

QUIZ QUESTION::

Match each term with its description.

ANSWER CHOICES:



DESCRIPTION

TERM

A block of code that has a name, but doesn't run until we tell it to

A statement that makes a function run

A value that we can pass to a function when we call that function

A function associated with an object

SOLUTION:

DESCRIPTION

TERM

A statement that makes a function run

A function associated with an object

A block of code that has a name, but doesn't run until we tell it to

A value that we can pass to a function when we call that function

Here is a call to a function named print_list_elements:
print_list_elements(list)
Which part of this code is referred to as an argument?

SOLUTION: `list`

Here is a call to a function named print_list_elements:
print_list_elements()
Which part of this code is referred to as an argument?

SOLUTION: There is no argument in this function call